<?php
/**
 * $Id: T.php 31 2011-11-22 06:22:25Z kylingood $
 *
 */
require_once 'Zend/View/Helper/Abstract.php';


class Custom_View_Helper_T extends Zend_View_Helper_Abstract
{
    protected static $_lang;
	
    public function t($key,$options = null)
	{
		$locale = array(1=>'zh','en','zh_TW');
		$langID = 1;
		
		return $locale[$langID];
	}
   
    public function st($key,$options = null)
    {
    	$this->loadLang();	
		if(isset($this->_lang[$key])){
			return $this->_lang[$key];
		}else{		
			return $key;
		}
		
    }
    
    protected function loadLang()
    {
	
    	if(isset($this->_lang) && !empty($this->_lang))return $this->_lang;

		$idtofile = array(1=>'zh-cn','en','zh');
		$langID = 1;

		
		$langID =1;		
		if(!isset($this->_lang) or empty($this->_lang)){				
			$this->_lang = include PROJECT_ROOT.'/app/languages/default/'.$idtofile[$langID].'.php';
		}
		
		return true;

    }
    
}
